/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ages.xml

import com.ages.entity.Joint
import com.ages.graphics.AnimatedSprite
import com.ages.entity.Model
import java.io.File
import scala.None
import scala.xml.Elem
import scala.xml.Node
import scala.xml.NodeSeq
import scala.xml.XML

object TestXML {

  def main(args:Array[String])
  {

//    val file = getClass.getResource("/com/ages/test/res/skeleton_test.xml").getFile
//    val xml:Elem = XML.loadFile(file)
//    val imgSrc = ((xml \\ "img") \\ "@src").text
//
//
//    var skeleton = new Joint("NA")
//    for (x<- xml \ "joint")
//    {
//      skeleton = new Joint(x.attribute("name").get.toString)
//      buildModel(x.asInstanceOf[Elem],skeleton)
//    }
//    println(skeleton.flatList)
    val model = new Model("/com/ages/test/res/skeleton_test.xml")
  }

  def buildModel(e:Elem,j:Joint)
  {
    for(x <- e \ "joint")
    {
      val name = x.attribute("name").get.toString
      j.addJoint(new Joint(name,0))
      buildModel(x.asInstanceOf[Elem],j)
    }
  }
}
